import { Http } from "../../utils/http"
import { Order } from "../../model/Order"

Page({

  /**
   * 页面的初始数据
   */
  data: {
    goodList:[],
    id:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.tape == 1);
    
    let that = this;
    that.setData({
      id:options.id
    })
    if(options.tape == 1){
      that.onregi();
    }else{
      that.oncard();
    }
    // console.log(result);
  },

  //获取自己核销的订单详情页
  onregi: async function(){
    let result = await Order.get_verify_order_detail_by_user(this.data.id);
    if(result.code == 0){
      this.setData({
        goodList: result.data
      })
      // console.log(this.data.goodList);
    }else{
      wx.showToast({
        title: result.msg,
        duration: 2000,
        icon: 'none'
        });
    }
  },

  //获取自己核销的订单详情页 - 卡
  oncard: async function(){
    let result = await Order.get_verify_order_detail_by_user_card(this.data.id);
    if(result.code == 0){
      this.setData({
        goodList: result.data
      })
      // console.log(this.data.goodList);
    }else{
      wx.showToast({
        title: result.msg,
        duration: 2000,
        icon: 'none'
        });
    }
  }

})